<template>
  <el-dialog :visible.sync="visible" v-dialogDrag :title="title" :append-to-body="true" :close-on-click-modal="false" class="tl-dialog" width="800px" @open="open" @close="close">
  <div class="app-container">
    <div>
      <!--表格渲染-->
      <el-table class="tl-table" ref="mainTable" height="300px" resizable-key="tableHeight" :resizable-refs="tableResizeRefs" v-loading="loading" :data="datas" @selection-change="doSelectChange" @sort-change="doSortChange" @row-dblclick="doRowDbClick" @row-click="doRowClick" row-key="id" border fit :row-class-name="doChangeRowClassName">
        <el-table-column type="index" label="序号" width="55px" align="center"></el-table-column>
		<el-table-column prop="oldprojectmanager" label="离职/转岗人员" min-width="150px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
		<el-table-column prop="oldprojectmanagercode" label="离职/转岗人员工号" width="150px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column prop="dispstate" label="单据状态" width="100px" align="center" header-align="center" :show-overflow-tooltip="true"></el-table-column>
        <el-table-column label="操作" width="100px" v-slot="scope" fixed="right">
          <el-dropdown trigger="hover">
            <el-button type="text" icon="el-icon-s-operation" style="margin-left:10px">更多<i class="el-icon-arrow-down el-icon--right"></i></el-button>
            <el-dropdown-menu>
              <el-dropdown-item  icon="el-icon-edit" @click.native="openEditDialog('editForm', scope.row.id)" :disabled="scope.row.state !== 0 && scope.row.state !== 2">编辑</el-dropdown-item>
              <el-dropdown-item  icon="el-icon-delete" :disabled="scope.row.state !== 0 && scope.row.state !== 2" @click.native="doDelete(scope.row.id)">删除</el-dropdown-item>
              <el-dropdown-item icon="el-icon-view" @click.native="openViewDialog('editForm', scope.row.id)">查看</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-table-column>
      </el-table>
      <!-- 列表分页 -->
      <el-row class="pagebar" ref="pager">
        <el-pagination @size-change="doChangeSize" @current-change="doChangeIndex" :current-page="pageInfo.currentPage" :page-sizes="pageInfo.pageSizes" :total="pageInfo.totalCount" layout="total, sizes, prev, pager, next, jumper" background class="tl-table-pagination"> </el-pagination>
      </el-row>
      <tl-edit ref="editForm" @refresh="doRefresh"></tl-edit>
    </div>
  </div>
  </el-dialog>
</template>

<script>
/** mixins */
import { mixin_list } from '@tapui/mixins/mixin_list'
/** 工具类 */
import { getAction, putAction, postAction, deleteAction } from '@tapui/utils/http'
export default {
  name: 'mpmProjectChangeManager',
  mixins: [mixin_list],
  components: { 'tlEdit': () => import('./edit') },
  data() {
    return {
      description: '离职人员工作交接-列表查询',
      urlPrefix: '/mpm/projectChangeManager/',
      url: {
        queryCodeList: '/mpm/projectChangeManager/dataCodeList'
      },
      // 排序参数
      sorterInfo: {
        sidx: 'createon',
        sord: 'desc'
      },
      isQueryOnCreated: false,
      visible: false,
      title: '历史交接'
    }
  },
  props: {
    lastid: {
      type: Number,
      default: 0
    }
  },
  methods: {
    open() {
        this.$nextTick(() => {
            this.$set(this.queryParam, 'qry_usercode', this.user.code)
            this.doQuery()
        })
    },
    afterLoadData() {
      this.datas = this.datas.filter(item => item.id !== this.lastid)
    },
    /** 表格双击事件 */
    doRowDbClick(row, column, event) {
      if (row.state === 0 || row.state === 2) {
        this.openEditDialog('editForm', row[this.$refs.mainTable.rowKey])
      } else {
        this.openViewDialog('editForm', row[this.$refs.mainTable.rowKey])
      }
    },
    close() {}
  }
}
</script>

<style scoped></style>

